<?php

use think\facade\Route;

require_once __DIR__ . '/pc.php';
require_once __DIR__ . '/api.php';
require_once __DIR__ . '/group.php';

// miss路由11
Route::miss(function () {
    return 'Route Not Found!';
});
Route::any('index1', 'Index/index1');
Route::any('test', 'Index/test');
// api接口无需token模块
Route::group('admin', function () {
    // 首页路由
    Route::group('index', function () {
        Route::post('login', 'admin.Index/login');
        Route::post('getWebConfig', 'admin.Index/getWebConfig');
        Route::post('getSmsCode', 'admin.Index/getSmsCode');
    });
})->allowCrossDomain();


// 后端接口需token模块
Route::group('admin', function () {
    // 首页路由
    Route::group('index', function () {
        Route::post('getInfo', 'admin.Index/getInfo'); // 首页统计数据
        Route::post('getDauList', 'admin.Index/getDauList'); // 首页每日活跃用户
    });
    // 用户模块
    Route::group('user', function () {
        Route::post('getList', 'admin.User/getList');// 获取用户列表
        Route::post('setUserStatus', 'admin.User/setUserStatus');// 启用，禁用
        Route::post('getUserFriendList', 'admin.User/getUserFriendList');// 好友列表
        Route::post('add', 'admin.User/add');// 添加用户
        Route::post('info', 'admin.User/info');// 获取用户信息
        Route::post('del', 'admin.User/del');// 删除用户
        Route::post('logout', 'admin.User/logout');// 退出登录
        Route::post('setUserInfo', 'admin.User/setUserInfo');// 退出登录
        Route::post('getDesignUserArr', 'admin.User/getDesignUserArr');// 获取设计用户
        Route::post('getSaleUserArr', 'admin.User/getSaleUserArr');// 获取销售用户
    });
    // 设计师模块
    Route::group('design', function () {
        Route::post('getUserList', 'admin.Design/getList');// 获取设计师列表
        Route::post('generateCode', 'admin.Design/generateCode');// 生成登录码
        Route::post('download', 'admin.Design/download');// 下载
        Route::post('removeFile', 'admin.Design/removeFile');// 删除文件
    });
    // 销售模块
    Route::group('sale', function () {
        Route::post('getUserList', 'admin.Sale/getUserList');// 获取销售列表
    });
    // 售后模块
    Route::group('service', function () {
        Route::post('getUserList', 'admin.Service/getUserList');// 获取售后列表
    });
    // 管理用户模块
    Route::group('admin_user', function () {
        Route::post('getUserList', 'admin.AdminUser/getList');// 获取用户列表
        Route::post('add', 'admin.AdminUser/add');// 添加用户
        Route::post('del', 'admin.AdminUser/del');// 删除用户
        Route::post('loginOut', 'admin.AdminUser/loginOut');// 退出登录
    });
    // 群聊
    Route::group('chat', function () {
        Route::post('getChatList', 'admin.Chat/getChatList');// 获取群聊列表
        Route::post('getChatRecord', 'admin.Chat/getChatRecord');// 获取聊天记录
        Route::post('getChatInfo', 'admin.Chat/getChatInfo');// 获取聊天记录
        Route::post('download', 'admin.Chat/download');// 下载聊天记录
        Route::post('removeFile', 'admin.Chat/removeFile');// 删除文件
    });
    // 菜单模块
    Route::group('menu', function () {
        Route::post('getUserMenuList', 'admin.Menu/getUserMenuList');// 后台左侧菜单栏
        Route::post('getRoleMenuList', 'admin.Menu/getRoleMenuList');// 后台左侧菜单栏 根据角色获取菜单列表
        Route::post('getMenuList', 'admin.Menu/getMenuList');// 获取全部菜单列表
        Route::post('getRuleMenuList', 'admin.Menu/getRuleMenuList');// 配置菜单权限
        Route::post('getMenuInfo', 'admin.Menu/getMenuInfo');// 获取菜单信息
        Route::post('saveMenuInfo', 'admin.Menu/saveMenuInfo');// 修改菜单
        Route::post('add', 'admin.Menu/add');// 添加菜单
        Route::post('info', 'admin.Menu/info');// 菜单信息
        Route::post('del', 'admin.Menu/del');// 删除菜单
        Route::post('editRule', 'admin.Menu/editRule');// 配置角色规则
    });
    // 角色模块
    Route::group('role', function () {
        Route::post('add', 'admin.Role/add');// 添加角色
        Route::post('edit', 'admin.Role/edit');// 修改角色
        Route::post('del', 'admin.Role/del');// 删除角色
        Route::post('info', 'admin.Role/info'); // 角色信息
        Route::post('saveRoleInfo', 'admin.Role/saveRoleInfo');//保存角色信息
        Route::post('getRoleList', 'admin.Role/getRoleList');// 获取角色列表
        Route::post('getSelfAndNextRoleList', 'admin.Role/getSelfAndNextRoleList');// 获取角色列表
        Route::post('getNextRoleList', 'admin.Role/getNextRoleList');// 获取角色列表
    });
    // 业务类型
    Route::group('business', function () {
        Route::post('getList', 'admin.TypeBusiness/getList');
        Route::post('save', 'admin.TypeBusiness/save');
        Route::post('del', 'admin.TypeBusiness/del');
        Route::post('getArr', 'admin.TypeBusiness/getArr');
    });
    // 设计类型
    Route::group('design', function () {
        Route::post('getList', 'admin.TypeDesign/getList');
        Route::post('save', 'admin.TypeDesign/save');
        Route::post('del', 'admin.TypeDesign/del');
        Route::post('getArr', 'admin.TypeDesign/getArr');
    });
    // 扩展字段
    Route::group('field', function () {
        Route::post('getList', 'admin.TypeField/getList');
        Route::post('save', 'admin.TypeField/save');
        Route::post('del', 'admin.TypeField/del');
        Route::post('getArr', 'admin.TypeField/getArr');
    });
    // 项目类型
    Route::group('program', function () {
        Route::post('getList', 'admin.TypeProgram/getList');
        Route::post('save', 'admin.TypeProgram/save');
        Route::post('del', 'admin.TypeProgram/del');
        Route::post('getArr', 'admin.TypeProgram/getArr');
    });
    // 支付方式
    Route::group('pay', function () {
        Route::post('getList', 'admin.TypePay/getList');
        Route::post('save', 'admin.TypePay/save');
        Route::post('del', 'admin.TypePay/del');
        Route::post('getArr', 'admin.TypePay/getArr');
    });
    // 敏感词管理
    Route::group('word', function () {
        Route::post('getList', 'admin.SensitiveWord/getList');
        Route::post('save', 'admin.SensitiveWord/save');
        Route::post('del', 'admin.SensitiveWord/del');
        Route::post('getTriggerRecord', 'admin.SensitiveWord/getTriggerRecord'); // 触发敏感词触发记录
        Route::post('getTriggerList', 'admin.SensitiveWord/getTriggerList'); // 触发敏感词记录
        Route::post('getMsgRecord', 'admin.SensitiveWord/getMsgRecord'); // 聊天记录
    });
    // 投诉模块
    Route::group('complain', function () {
        Route::post('getList', 'admin.Complain/getList');// 获取投诉列表
        Route::post('save', 'admin.Complain/save');// 投诉处理
    });
    // 评价模块
    Route::group('eva', function () {
        Route::post('getList', 'admin.DesignScore/getList');// 获取评价列表
    });
    // 积分商品模块
    Route::group('integralGoods', function () {
        Route::post('getList', 'admin.IntegralGoods/getList');// 获取商品列表
        Route::post('add', 'admin.IntegralGoods/add');// 添加商品信息
        Route::post('edit', 'admin.IntegralGoods/edit');// 编辑商品信息
        Route::post('del', 'admin.IntegralGoods/del');// 更新商品状态
        Route::post('status', 'admin.IntegralGoods/status');// 上下架
    });
    // 图片上传
    Route::group('image', function () {
        Route::post('uploadImg', 'admin.Image/uploadFile');// 文件上传
        Route::post('uploadFile', 'admin.Image/uploadFile');// 文件上传
        Route::post('uploadImage', 'admin.Image/uploadImage');// 富文本图片上传
        Route::post('uploadAvatarFile', 'admin.Image/upload');// 富文本图片上传
    });
    // 配置模块
    Route::group('config', function () {
        Route::post('setConfig', 'admin.Config/setConfig');// 网站配置
        Route::post('getConfigInfo', 'admin.Config/getConfigInfo');// 网站配置
        Route::post('getConfigInfoByName', 'admin.Config/getConfigInfoByName');// 网站配置
        Route::post('setSysInfo', 'admin.Config/setSysInfo');// 网站配置
        Route::post('setChatInfo', 'admin.Config/setChatInfo');// 网站配置
        Route::post('setFileUpload', 'admin.Config/setFileUpload');// 上传配置
    });
    // 文章
    Route::group('article', function () {
        Route::post('getList', 'admin.Article/getList');
        Route::post('save', 'admin.Article/save');
        Route::post('del', 'admin.Article/del');
    });
    // 提现记录
    Route::group('finance', function () {
        Route::post('getWithdrawList', 'admin.Finance/getWithdrawList');
        Route::post('getTechWithdrawList', 'admin.Finance/getTechWithdrawList');
        Route::post('getBalanceList', 'admin.Finance/getBalanceList');
        Route::post('getTechBalanceList', 'admin.Finance/getTechBalanceList');
        Route::post('audit', 'admin.Finance/audit');
        Route::post('techAudit', 'admin.Finance/techAudit');
        Route::post('getBalanceType', 'admin.Finance/getBalanceType');// 余额变更类型
        Route::post('getIntegralType', 'admin.Finance/getIntegralType');//  积分变更类型
        Route::post('getIntegralList', 'admin.Finance/getIntegralList');//  积分变更记录
    });
    // 订单
    Route::group('order', function () {
        Route::post('getOrderStatusArr', 'admin.Order/getOrderStatusArr'); // 获取订单状态
        Route::post('getOrderFieldArr', 'admin.Order/getOrderFieldArr'); // 获取订单扩展字段
        Route::post('getList', 'admin.Order/getList');// 获取订单列表
        Route::post('save', 'admin.Order/save');// 添加订单
        Route::post('getOrderDetail', 'admin.Order/getOrderDetail');
        Route::post('changeOrderStatus', 'admin.Order/changeOrderStatus'); //修改订单状态
        Route::post('stopOrder', 'admin.Order/stopOrder'); // 暂停订单
        Route::post('startOrder', 'admin.Order/startOrder'); // 开始订单
        Route::post('del', 'admin.Order/del'); // 删除订单
        Route::post('assign', 'admin.Order/assignOrder'); // 订单指派销售和设计师
        Route::post('getOrderInfo', 'admin.Order/getOrderInfo'); // 订单详情
        Route::post('getCreateOrderOptionArr', 'admin.Order/getCreateOrderOptionArr'); // 获取创建订单时的选项
        Route::post('uploadVoucher', 'admin.Order/uploadVoucher'); // 上传凭证
        Route::post('collection', 'admin.Order/collection'); // 已收尾款
    });
    // 用户等级
    Route::group('user_level', function () {
        Route::post('getList', 'admin.UserLevel/getList');
        Route::post('add', 'admin.UserLevel/add');
        Route::post('edit', 'admin.UserLevel/edit');
        Route::post('del', 'admin.UserLevel/del');
    });
    // 店铺
    Route::group('shop', function () {
        Route::post('getList', 'admin.Shop/getList');
        Route::post('edit', 'admin.Shop/edit');
        Route::post('status', 'admin.Shop/status');
        Route::post('del', 'admin.Shop/del');
    });
    // 分类
    Route::group('category', function () {
        Route::post('getList', 'admin.Category/getList');
        Route::post('save', 'admin.Category/save');
        Route::post('del', 'admin.Category/del');
        Route::post('getCategoryArr', 'admin.Category/getCategoryArr');
    });
    // 日志
    Route::group('log', function () {
        Route::post('getList', 'admin.AdminLog/getList');
        Route::post('clearLog', 'admin.AdminLog/clearLog');
    });
    // 任务管理
    Route::group('task', function () {
        Route::post('getTaskList', 'admin.Task/getTaskList');
    });
    // 部门模块
    Route::group('department', function () {
        Route::post('getList', 'admin.Department/getList');// 获取部门列表
        Route::post('save', 'admin.Department/save');// 添加
        Route::post('del', 'admin.Department/del');// 删除
        Route::post('getDepartmentArr', 'admin.Department/getDepartmentArr');// 列表
    });
    Route::group('sms', function () {
        Route::post('getList', 'admin.Sms/getList');
    });
})->allowCrossDomain()->middleware('Auth');